#!/usr/bin/env python
# -*- coding:utf-8 -*-

# file:homework4_3.py
# author:wmf
# datetime:2021/4/11 18:01
# software: PyCharm
'''
this is function description
'''
# import module your need

# 3  从键盘输入5个同学的账号和密码,然后将他们的姓名,账号和密码(密码需要加密)保存到一个文件中;
#         Tom   admin   XXXXX
#         Jack   root      XXXXX
import base64

for i in range(1,6):
    string = input("第" + str(i) + "个同学的姓名账号和密码:")
    info = string.split(' ')
    print(info)
    info[2] = base64.b64encode(info[2].encode())
    info[2] = str(info[2])
    info[2] = info[2][2:len(info[2])-1]
    with open('secret.txt','a') as f:
        for x in info:
            f.write(x)
            f.write(' ')
        f.write('\n')